package com.tbit.main.service.impl;

import com.tbit.main.constant.DaoParamConstant;
import com.tbit.main.dao.core.AccountEventDao;
import com.tbit.main.pojo.AccountEvent;
import com.tbit.main.service.AccountEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2020-11-12 15:50
 * 大事件
 */
@Service("accountEventService")
public class AccountEventServiceImpl implements AccountEventService {

    @Autowired
    private AccountEventDao accountEventDao;

    @Override
    public void insert(AccountEvent accountEvent) {
        accountEventDao.insert(accountEvent);
    }

    @Override
    public void insertUpdate(List<Map<String, Object>> map) {
        accountEventDao.insertUpdate(map);
    }

    @Override
    public void update(AccountEvent accountEvent) {
        accountEventDao.update(accountEvent);
    }

    @Override
    public void del(Integer accountEventId) {
        accountEventDao.del(accountEventId);
    }

    @Override
    public List<AccountEvent> ByTime(Integer accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<>(8);
        params.put(DaoParamConstant.accountId, accountId);
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);
        return accountEventDao.byTime(params);
    }

    @Override
    public AccountEvent byAccountEventId(Integer accountEventId) {
        return accountEventDao.byAccountEventId(accountEventId);
    }
}
